<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block data-th-replace="/adminlte/base::base-head"></th:block>
<link rel="stylesheet" href="/plugins/datatables-bs4/css/dataTables.bootstrap4.css">
</head>
<body class="hold-transition sidebar-mini layout-fixed">
<div class="modal fade" id="dialog-tag-add">
   <div class="modal-dialog">
       <div class="modal-content" style="border-radius:5px; margin-top: 10%; border-radius: 5px;">
       	<div class="modal-header">
       		<h4 class="modal-title">新增标签</h4>
       		<button type="button" class="close" data-dismiss="modal" aria-label="Close">
				<span aria-hidden="true">&times;</span>
			</button>
		</div>
		<form role="form" action="/articles/tags" method="post">
			<div class="modal-body">
				<div class="form-group">
					<label><span class="text-red">*</span> 标签名称</label> <input type="text" class="form-control" name="name" placeholder="标签名称" autofocus="autofocus">
				</div>
			</div>
			<div class="modal-footer">
				<button class="btn btn-default float-left" data-dismiss="modal" style="width: 100px" type="button">取消</button>
                <button class="btn btn-success float-right" style="width: 100px" type="submit">确定</button>
				</div>
			</form>
        </div>
    </div>
</div>
<div class="wrapper">
<th:block data-th-replace="/adminlte/base::base-navbar"></th:block>
<th:block data-th-replace="/adminlte/base::base-main-sidebar"></th:block>
<div class="content-wrapper">
	<th:block data-th-replace="/adminlte/base::base-content-header"></th:block>
	<section class="content">
		<div class="container-fluid">
			<div class="card">
	            <div class="card-header">
	            	<div class="row mt-2">
		              <button class="btn btn-app" data-dialog="show" data-url="#dialog-tag-add">
		                <i class="fas fa-plus text-blue"></i> 新增标签
		              </button>
	            	</div>
	            </div>
	            <div class="card-body">
	            	<div class="table-responsive">
		              <table id="article-tag-table" class="table table-bordered table-hover" data-url="/articles/tags/">
		              	<colgroup>
		              		<col width="50"/>
		              		<col />
		              		<col width="80"/>
		              	</colgroup>
		                <thead>
			                <tr>
								<th>ID</th>
								<th>名称</th>
								<th>操作</th>
			                </tr>
		                </thead>
		                <tbody>
		                	<tr data-th-each="articleTag : ${articleTagUtils.list()}" th:data-key="${articleTag.id}">
								<td data-th-utext="${articleTag.id}">排序</td>
								<td data-th-utext="${articleTag.name}" data-col-name="name" contenteditable="true">角色名称</td>
								<td class="td-manage">
									<a title="查看文章" th:href="${'/admin/article/view?tag='+articleTag.name}" style="margin-left: 10px;">
										<i class="fas fa-search text-blue"></i>
									</a>
									<a title="删除标签" data-dialog="confirm" data-url="/articles/tags/" data-method="delete" th:data-path="${articleTag.id}"
									   data-dialog-t-msg="您确定要删除当前标签吗？" style="margin-left: 10px;">
										<i class="fas fa-trash text-blue"></i>
									</a>
								</td>
							</tr>
		                </tbody>
		              </table>
	            	</div>
	            </div>
	     	</div>
		</div>
	</section>
</div>
<th:block data-th-replace="/adminlte/base::base-footer"></th:block>
<th:block data-th-replace="/adminlte/base::base-control-sidebar"></th:block>
</div>
<script src="/plugins/datatables/jquery.dataTables.js"></script>
<script src="/plugins/datatables-bs4/js/dataTables.bootstrap4.js"></script>
<script src="/kaibes/js/table-data.js"></script>
<script src="/kaibes/js/table-update.js"></script>
<script type="text/javascript">
	dataTable(0, [1, 2]);
</script>
</body>
</html>